<div class="box_type02">
	<h2 class="txt">방문경로 통계 / 방문경로 분석</h2>
	<p class="icon"><a href="javascript:void(0);" class="icon_m04">매뉴얼</a></p>

	<div class="ipTop">
		<a href="javascript:void(0);" class="btn_arrow_prev"></a>
		<strong><?php echo date('Y')?> <span>/</span> <?php echo date('m')?></strong>
		<a href="javascript:void(0);" class="btn_arrow_next"></a>
	</div>
	<?php 
	global $access;
	global $translation;
	$BBC_DETAILED_STAT_FIELDS = "id, time, ext, dns, visits, os, browser, referer";
	//require_once('./asset/bbclone/conf/config.php');
	require_once('./asset/bbclone/constants.php');
	require_once('./asset/bbclone/language/ko.php');
	
	
	function bbc_refgen($ref) {
		global $translation;
		if ($ref == "not_specified") return "<i>".$translation['misc_ignored']."</i>";
		$ref_name = (($slash = strpos($ref, "/")) !== false) ? substr($ref, 0, $slash) : $ref;
	
		return "<script type=\"text/javascript\">\n"
		."<!--\n"
		."document.write('<a href=\"http://$ref\" rel=\"nofollow\" title=\"$ref_name\">$ref_name<\/a>');\n"
		."-->\n"
		."</script>\n"
		."<noscript><span title=\"$ref_name\">$ref_name</span></noscript>\n";
	}
	
	$referer_tab = isset($access['referer']) ? $access['referer'] : array();
	
	for ($referer_total = 0; list(, $referer_score) = each($referer_tab); $referer_total += $referer_score);
	arsort($referer_tab);
	reset($referer_tab);
	
	//$str = bbc_rank_head($BBC_MAXORIGIN, "gstat_origins", 1);
	
	/*for ($k = 0; (list($referer_name, $referer_score) = each($referer_tab)); $k++) {
		echo $referer_name."<br>";
		//$str .= bbc_list_item("", bbc_refgen($referer_name), $referer_score, $referer_total, 'origins');
	}*/
	
	//$str .= bbc_rank_sum($referer_total, 1);
	?>

	<!--[s] 목록 -->
	<table cellspacing="0" summary="방문경로 분석">
		<caption>방문경로 분석</caption>
		<thead>
		<tr>
			<th scope="col" width="55">순위</th>
			<th scope="col" width="130">방문경로</th>
			<th scope="col">그래프</th>
			<th scope="col" width="100">방문자수</th>
		</tr>
		</thead>
		<tbody>
		<?php 
			for ($k = 0; (list($referer_name, $referer_score) = each($referer_tab)); $k++) {
				//bbc_list_item("", bbc_refgen($referer_name), $referer_score, $referer_total, 'origins');
		?>
		<tr>
			<th scope="row"><p>1</p></th>
			<td><div><?php echo bbc_refgen($referer_name);?></div></td>
			<td class="graph">
				<div>
					<p style="width:<?php echo sprintf("%.2f%%", (round(10000 * $referer_score / $referer_total) / 100))?>;"><span><?php echo sprintf("%.0f%%", (round(10000 * $referer_score / $referer_total) / 100))?></span></p>
				</div>
			</td>
			<td><div><?php echo $referer_score;?></div></td>
		</tr>
		<?php 
			}
		?>

		</tbody>
	</table>
	<!--[e] 목록 -->

	<!--[s] Tip -->
	<dl id="tip" class="">
		<dt>Tip</dt>
		<dd>인터넷익스플로러의 '호환성보기' 기능을 사용중인 접속자에게 자동으로 최신버전 기준으로 사이트를 출력하도록 처리합니다.</dd>
		<dd>코딩방식에 따라 특정 버전의 브라우저에서 사이트가 깨질수 있으니, 충분한 테스트 후 기능을 설정해 주시기 바랍니다.</dd>
	</dl>
	<!--[e] Tip -->
</div>